package com.jumper.study.db.dao;

import java.time.LocalDateTime;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jumper.study.db.dto.DateCountDto;
import com.jumper.study.db.model.Account;

public interface AccountMapper extends BaseMapper<Account> {
    default boolean usernameExist(String username) {
        LambdaQueryWrapper<Account> query = Wrappers.lambdaQuery();
        query.eq(Account::getUsername, username);
        return exists(query);
    }

    /**
     * 统计注册用户数
     * @param start
     * @param end
     * @return
     */
    List<DateCountDto> selectRegisterCount(LocalDateTime start, LocalDateTime end);
}
